//
//  QSWorkStationSearchCell.m
//  DigitalEconomy_iOS
//
//  Created by Ding on 2020/5/20.
//  Copyright © 2020 DingC. All rights reserved.
//

#import "QSWorkStationSearchCell.h"

@implementation QSWorkStationSearchCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
    [self configSubView];
    
}
- (void)configSubView{
    self.leftImageView.layer.cornerRadius = 22;
    self.leftImageView.layer.masksToBounds = YES;
    self.leftImageView.contentMode = UIViewContentModeScaleAspectFill;
    self.stateLabel.layer.cornerRadius = 3;
    self.stateLabel.layer.masksToBounds = YES;
}

- (void)setModel:(QSWorkStationPersonModel *)model{
    _model = model;
    [self.leftImageView sd_setImageWithURL:[NSURL URLWithString:model.headPic]];
    self.nameLabel.text = model.adminName;
    self.companyLabel.text = model.roleName;
    self.dateLabel.text = [NSString stringWithFormat:@"%@", [NSDate dateWithTimestamp:model.ewFinishTime format:@"yyyy-MM-dd HH:mm"]];
    if (!model.headPic) {
        [self.leftImageView setImage:[UIImage imageNamed:@"user_defult_icon"]];
    }
    if (model.ewPersonState.intValue == 0) {
        self.stateLabel.text = @"待完成";
        self.stateLabel.backgroundColor = [UIColor QSColorGrayF5F5F5];
        self.stateLabel.textColor = [UIColor colorWithHexString:@"#999999"];
        self.dateLabel.hidden = YES;
    }else{
        self.stateLabel.text = @"已完成";
        self.stateLabel.textColor = [UIColor colorWithHexString:@"#27BA85"];
        self.stateLabel.backgroundColor = [UIColor colorWithRed:196.0f / 255.0f  green:234.0f / 255.0f blue:220.0f / 255.0f alpha:1];
        self.dateLabel.hidden = NO;

    }
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
